#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QDebug>
#include <QVector>
#include "pcap.h"
#include "winsock2.h"
#include "multhread.h"
#include "sendicmp.h"
#include "httprequest.h"


QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void showNetworkCard();
    int capture();

private slots:
    void on_comboBox_currentIndexChanged(int index);

    void on_tableWidget_cellClicked(int row, int column);

    void on_pushButton_clicked();

    void on_pushButton_2_clicked();

    void on_lineEdit_5_returnPressed();

    void on_pushButton_3_clicked();

protected:
    bool eventFilter(QObject *obj, QEvent *event) override;

public slots:
    void HandleMessage(DataPackAge data);
    void icmpHandleMessage(QString info);
    void httpHandleMessage(QString position);

private:
    Ui::MainWindow *ui;
    pcap_if_t *all_device;
    pcap_if_t *device;
    pcap_t *pointer;
    QVector<DataPackAge> pData;
    int countNumber;
    char errbuf[PCAP_ERRBUF_SIZE];
    int numberRow;
    sendIcmp *sender = nullptr;

    httpRequest *http;

    bool m_mouseInTable = false;
};
#endif // MAINWINDOW_H
